﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel.Design;

namespace kongjian32
{
    [Designer(typeof(kongjian31.LineDesigner))]
    public partial class shujiexian10kv : TongJi_EMS._TJ_Basic.TJ_BasicControl
    {
        private Color lineC = Color.Red;
        private int lineWidth = 2;

        public shujiexian10kv()
        {
            InitializeComponent();
        }

        public Color LineColor
        {
            get { return lineC; }
            set
            {
                lineC = value; 
                IComponentChangeService ccs = (IComponentChangeService)this.BasicControlDesigner.GetService_Open(typeof(IComponentChangeService));
                if (ccs != null)
                {
                    PropertyDescriptor lineColorProp = TypeDescriptor.GetProperties(this)["LineColor"];
                    ccs.OnComponentChanged(this, lineColorProp, null, null);
                    ccs.OnComponentChanging(this, lineColorProp);
                }
                this.Refresh();
            }
        }

        public int LineWidth
        {
            get { return lineWidth; }
            set
            {
                lineWidth = value; if (lineWidth > 2)
                {
                    this.Width = lineWidth;
                }
                this.Refresh();
            }
        }

        private void shujiexian10kv_Load(object sender, EventArgs e)
        {
            shujiexian10kv_Resize(sender, e);
        }

        private void shujiexian10kv_Paint(object sender, PaintEventArgs e)
        {
            Pen a = new Pen(CtrColor, lineWidth);
            e.Graphics.DrawLine(a, x, 0, x, y * 2f);

        }

        private void shujiexian10kv_Resize(object sender, EventArgs e)
        {
            this.x = this.Width / 2;
            this.y = this.Height / 2;
            //this.Refresh();
        }



    }
}